<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@page import="com.utility.*,com.bean.*" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Mobile Shop</title>
</head>
<body>

<%! MobileDAO mobileDAO = new MobileDAO(); int id; Mobile mobile; %>

<%  
	
	try
	{
		id = Integer.parseInt(request.getParameter("id").trim());
	}
	catch(Exception ex)
	{
		out.print("<font size='4' color='red' > Wrong ID </font> <br />");
		out.print("<a href='javascript:history.back()'> Back </a>");
		return;
	}
	
	mobile = mobileDAO.get(id);
	
	if (mobile == null)
	{
		out.print("<font size='4' color='red' > Mobile ID not Found </font> <br />");
		out.print("<a href='javascript:history.back()'> Back </a>");
		return;
	}
	
	String model = mobile.getModel();
	String company = mobile.getCompany();
	String camera = mobile.getCamera();
	int price = mobile.getPrice();
%>

	<h2> Update Your Mobile </h2> <hr />
	
	<form action="UpdateServlet" method="post">
	
	<table border="1">

		<%-- <tr>
			<td> <input type="text" name="id" value="${id}" />  </td>
			<td> <input type="text" name="model" value="${model}" />  </td>
			<td> <input type="text" name="company" value="${company}" />  </td>
			<td> <input type="text" name="camera" value="${camera}" />  </td>
			<td> <input type="text" name="price" value="${price}" />  </td>
		</tr> --%>
		
			<tr><th> ID </th>  <td> <input type="text" name="id" value="<%= id %>" readonly="readonly"/>  </td></tr>
			<tr><th> Model Name </th>  <td> <input type="text" name="model" value="<%= model %>" />  </td></tr>
			<tr><th> Company </th> <td> <input type="text" name="company" value="<%= company %>" />  </td></tr>
			<tr><th> Camera </th>  <td> <input type="text" name="camera" value="<%= camera %>" />  </td></tr>
			<tr><th> Price </th> <td> <input type="text" name="price" value="<%= price %>" />  </td></tr>

	</table>
	
	<input type="submit" />
	
	</form>
	
	<br />
	<a href="javascript:history.back()"> Back </a>

</body>
</html>